package wnco.base;

import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Date;

public class FilterFunctionW {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        DataStreamSource<SomData> dss = env.fromElements(
                new SomData("aa", 1, 496656L),
                new SomData("bb", 2, 745451L),
                new SomData("cc", 3, 351548L),
                new SomData("dd", 4, 126988L),
                new SomData("ee", 5, 984656L));
        SingleOutputStreamOperator<SomData> filter = dss.filter((FilterFunction<SomData>) value -> value.getAge()%2==0);
        filter.print();
        env.execute();
    }
}

